package com.zhang.schedul;

import com.alibaba.fastjson.JSON;
import com.zhang.handle.NettyMessageHandle;
import com.zhang.service.MonitorService;
import com.zhang.socket.WebSocket;
import com.zhang.util.DeviceRedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.HashMap;

/**
 * User: 张
 * Date: 2024-11-14
 * Time: 8:53
 * Description:
 */
@Component
public class ScheduledTasks {
    @Autowired
    private MonitorService monitorService;
    @Scheduled(cron = "0/5 * * * * ?")
    public void MonitorTask(){
        if (!WebSocket.webSocketSet.isEmpty()){
            WebSocket.sendMessage(JSON.toJSONString(monitorService.checkServiceStatus()));
        }

    }

}
